﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WPLDB.DA.Models
{
    /// <summary>
    /// This model holds the connection string information.
    /// </summary>
    public class ConnectionModel
    {
        public string DataSource { get; set; }
        public Authentication Mode { get; set; }
        public string Username { get; set; }
        public string Password { get; set; }
        public string Database { get; set; }

        public bool IsValid
        {
            get
            {
                return !string.IsNullOrWhiteSpace(DataSource) 
                    && (Mode == Authentication.Window
                        || (!string.IsNullOrWhiteSpace(Username)
                            && !string.IsNullOrWhiteSpace(Password)));
            }
        }

    }

}
